 package server;

 import constants.BattleConstants;
 import constants.GameConstants;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import tools.Randomizer;




 public class RandomRewards
 {
   private static final List<Integer> compiledGold;
   private static final List<Integer> compiledSilver;
   private static final List<Integer> compiledFishing;
   private static final List<Integer> compiledPeanut;
   private static final List<Integer> compiledEvent;
   private static final List<Integer> compiledEventC;
   private static final List<Integer> compiledEventB;
   private static final List<Integer> compiledEventA;
   private static final List<Integer> compiledPokemon;
   private static final List<Integer> compiledDrops;
   private static final List<Integer> compiledDropsB;
   private static final List<Integer> compiledDropsA;
   private static final List<Integer> tenPercent;

   static {
/*  30 */     List<Integer> returnArray = new ArrayList<>();

/*  32 */     processRewards(returnArray, GameConstants.goldrewards);

/*  34 */     compiledGold = returnArray;


/*  37 */     returnArray = new ArrayList<>();

/*  39 */     processRewards(returnArray, GameConstants.silverrewards);

/*  41 */     compiledSilver = returnArray;


/*  44 */     returnArray = new ArrayList<>();

/*  46 */     processRewards(returnArray, GameConstants.fishingReward);

/*  48 */     compiledFishing = returnArray;


/*  51 */     returnArray = new ArrayList<>();

/*  53 */     processRewards(returnArray, GameConstants.eventCommonReward);

/*  55 */     compiledEventC = returnArray;

/*  57 */     returnArray = new ArrayList<>();

/*  59 */     processRewards(returnArray, GameConstants.eventUncommonReward);

/*  61 */     compiledEventB = returnArray;

/*  63 */     returnArray = new ArrayList<>();

/*  65 */     processRewards(returnArray, GameConstants.eventRareReward);
/*  66 */     processRewardsSimple(returnArray, GameConstants.tenPercent);
/*  67 */     processRewardsSimple(returnArray, GameConstants.tenPercent);

/*  69 */     compiledEventA = returnArray;

/*  71 */     returnArray = new ArrayList<>();

/*  73 */     processRewards(returnArray, GameConstants.eventSuperReward);

/*  75 */     compiledEvent = returnArray;

/*  77 */     returnArray = new ArrayList<>();

/*  79 */     processRewards(returnArray, GameConstants.peanuts);

/*  81 */     compiledPeanut = returnArray;

/*  83 */     returnArray = new ArrayList<>();

/*  85 */     processPokemon(returnArray, (BattleConstants.PItem[])BattleConstants.PokemonItem.values());
/*  86 */     processPokemon(returnArray, (BattleConstants.PItem[])BattleConstants.HoldItem.values());

/*  88 */     compiledPokemon = returnArray;

/*  90 */     returnArray = new ArrayList<>();

/*  92 */     processRewardsSimple(returnArray, GameConstants.normalDrops);

/*  94 */     compiledDrops = returnArray;

/*  96 */     returnArray = new ArrayList<>();

/*  98 */     processRewardsSimple(returnArray, GameConstants.rareDrops);

/* 100 */     compiledDropsB = returnArray;

/* 102 */     returnArray = new ArrayList<>();

/* 104 */     processRewardsSimple(returnArray, GameConstants.superDrops);

/* 106 */     compiledDropsA = returnArray;

/* 108 */     returnArray = new ArrayList<>();

/* 110 */     processRewardsSimple(returnArray, GameConstants.tenPercent);

/* 112 */     tenPercent = returnArray;
   }

   private static void processRewards(List<Integer> returnArray, int[] list) {
/* 116 */     int lastitem = 0;
/* 117 */     for (int i = 0; i < list.length; i++) {
/* 118 */       if (i % 2 == 0) {
/* 119 */         lastitem = list[i];
       } else {
/* 121 */         for (int j = 0; j < list[i]; j++) {
/* 122 */           returnArray.add(Integer.valueOf(lastitem));
         }
       }
     }
/* 126 */     Collections.shuffle(returnArray);
   }

   private static void processRewardsSimple(List<Integer> returnArray, int[] list) {
/* 130 */     for (int aList : list) {
/* 131 */       returnArray.add(Integer.valueOf(aList));
     }
/* 133 */     Collections.shuffle(returnArray);
   }

   private static void processPokemon(List<Integer> returnArray, BattleConstants.PItem[] list) {
/* 137 */     for (BattleConstants.PItem lastitem : list) {
/* 138 */       for (int j = 0; j < lastitem.getItemChance(); j++) {
/* 139 */         returnArray.add(Integer.valueOf(lastitem.getId()));
       }
     }
/* 142 */     Collections.shuffle(returnArray);
   }

   public static int getGoldBoxReward() {
/* 146 */     return ((Integer)compiledGold.get(Randomizer.nextInt(compiledGold.size()))).intValue();
   }

   public static int getSilverBoxReward() {
/* 150 */     return ((Integer)compiledSilver.get(Randomizer.nextInt(compiledSilver.size()))).intValue();
   }

   public static int getFishingReward() {
/* 154 */     return ((Integer)compiledFishing.get(Randomizer.nextInt(compiledFishing.size()))).intValue();
   }

   public static int getPeanutReward() {
/* 158 */     return ((Integer)compiledPeanut.get(Randomizer.nextInt(compiledPeanut.size()))).intValue();
   }

   public static int getPokemonReward() {
/* 162 */     return ((Integer)compiledPokemon.get(Randomizer.nextInt(compiledPokemon.size()))).intValue();
   }

   public static int getEventReward() {
/* 166 */     int chance = Randomizer.nextInt(101);
/* 167 */     if (chance < 66)
/* 168 */       return ((Integer)compiledEventC.get(Randomizer.nextInt(compiledEventC.size()))).intValue(); 
/* 169 */     if (chance < 86)
/* 170 */       return ((Integer)compiledEventB.get(Randomizer.nextInt(compiledEventB.size()))).intValue(); 
/* 171 */     if (chance < 96) {
/* 172 */       return ((Integer)compiledEventA.get(Randomizer.nextInt(compiledEventA.size()))).intValue();
     }
/* 174 */     return ((Integer)compiledEvent.get(Randomizer.nextInt(compiledEvent.size()))).intValue();
   }


   public static int getDropReward() {
/* 179 */     int chance = Randomizer.nextInt(101);
/* 180 */     if (chance < 76)
/* 181 */       return ((Integer)compiledDrops.get(Randomizer.nextInt(compiledDrops.size()))).intValue(); 
/* 182 */     if (chance < 96) {
/* 183 */       return ((Integer)compiledDropsB.get(Randomizer.nextInt(compiledDropsB.size()))).intValue();
     }
/* 185 */     return ((Integer)compiledDropsA.get(Randomizer.nextInt(compiledDropsA.size()))).intValue();
   }


   public static List<Integer> getTenPercent() {
/* 190 */     return tenPercent;
   }

   public static void load() {}
 }


/* Location:              C:\PGX\Server.jar!\server\RandomRewards.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */